package cn.study.luckyapp.prize.command;

import cn.study.luckyapp.assembler.PrizeAssembler;
import cn.study.luckyclient.dto.PrizeUpdateCmd;
import cn.study.luckyclient.dto.data.PrizeVo;
import cn.study.luckydomain.gateway.PrizeGateway;
import cn.study.luckydomain.prize.PrizeEntity;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class PrizeUpdateCmdExe {
    private final PrizeGateway prizeGateway;
    public PrizeVo execute(PrizeUpdateCmd cmd){
        PrizeEntity update = prizeGateway.update(PrizeAssembler.toEntity(cmd));

        return PrizeAssembler.addPrizeVo(update);
    }
}
